package com.block.common.util;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * 
 */
public class ThreadPoolUtil {


//    private static final   ExecutorService executor =Executors.newSingleThreadExecutor();
//

    private static final   ExecutorService executor2 =Executors.newCachedThreadPool();

    private static final   ExecutorService mailExecutor =Executors.newSingleThreadExecutor();
//    public  static void   execute(Thread thread)
//    {
//        executor.execute(thread);
//    }
//    public  static void   execute(Runnable thread)
//    {
//        executor.execute(thread);
//    }

    public  static void   excuteMail(Runnable thread)
    {
        mailExecutor.execute(thread);
    }

    /**
     * TODO 改为自定义线程池
     * 返回值直接执行
     * @param callable
     */

    public  static <T> Future<T> submit(Callable<T> callable){
        return   executor2.submit(callable);
    }


}

